<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'basic';
$return=array();
/*******basic*******/
if($_RQ['op']=='basic'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->plugin_setting('basic',$postdata);
		exi('设置成功');
	}
	$footernav = array(
			array('title'=>'分润中心','icon'=>'icon-shouye','color'=>'#cc99ff','action'=>'jy_mlianfee/index/'),
			array('title'=>'分红','icon'=>'icon-caifua','color'=>'#66cc99','action'=>'jy_mlianfee/commission/'),
			array('title'=>'明细','icon'=>'icon-manageorder','color'=>'#ff9933','action'=>'jy_mlianfee/order/'),
			array('title'=>'抽成池','icon'=>'icon-manageorder','color'=>'#ff9933','action'=>'jy_mlianfee/ci_fee/'),
	);
	$return['item']=$this->plugin_setting('basic');
	$return['item']['footernav']=$return['item']['footernav']?$return['item']['footernav']:$footernav;
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'edit_tab'=>true,
		'edits'=>array(
			array(
				'title'=>'基本信息',
				'list'=>array(
					array('type'=>'switch','title'=>'是否启用？','name'=>'isopen','help'=>'启用后，本应用的才生效，否则所有分佣不生效'),
					array('type'=>'radio','title'=>'成为生态员条件','name'=>'become','options'=>'become'),
					array('type'=>'checkbox','title'=>'生态员升级考核指标','name'=>'level_up_types','options'=>'leveltype'),
					array('type'=>'checkbox','title'=>'佣金计算方式','name'=>'fenxiaototal_types','options'=>'fenxiaototal_types'),	
					array('type'=>'radio','title'=>'生态链计算方式','name'=>'lianrate_type','options'=>'rate_type'),
					array('type'=>'switch','title'=>'生态员是否需要审核','name'=>'become_check','isradio'=>'1'),
					array('type'=>'switch','title'=>'是否需要完善资料','name'=>'isinfo','isradio'=>'1'),
					array('type'=>'string','title'=>'网站名称','name'=>'title'),
					array('type'=>'image','title'=>'网站logo','name'=>'logo'),
					array('type'=>'string','title'=>'分享标题','name'=>'share_title'),
					array('type'=>'image','title'=>'分享图片','name'=>'share_image'),
					array('type'=>'string','title'=>'分享描述','name'=>'share_desc'),
				)
			),
			array(
				'title'=>'结算设置',
				'list'=>array(
					array('type'=>'switch','title'=>'下单即可结算','name'=>'is_jiesuan','help'=>'不用等完成订单，就可以结算！'),
					array('type'=>'checkbox','title'=>'支持的提现方式','name'=>'withdrawtype','options'=>'withdraw'),
					array('type'=>'string','title'=>'结算额度（元）','name'=>'balance_fee'),
					array('type'=>'string','title'=>'分红打款手续费（%）','name'=>'balance_per'),
					array('name'=>'commissiontype','title'=>'佣金金额计算方式','type'=>'radio','help'=>'第一种：按商品实际成交价×百分比；第二种：按商品利润：【实际成交价-成本】×百分比；','options'=>'commissiontype'),
					array('type'=>'string','title'=>'免手续费提现区间开始金额','name'=>'balance_money_start'),
					array('type'=>'string','title'=>'免手续费提现区间结束金额','name'=>'balance_money_end','help'=>'当提现手续费金额在此区间内时,不扣除提现手续费. 结束金额 必须大于 开始金额才能生效'),
					array('type'=>'string','title'=>'结算天数','name'=>'balance_day','help'=>'当订单完成后的n天后，订单才能申请结算,设置0或空，订单完成就可以结算'),
					array('type'=>'text','title'=>'手续费说明','name'=>'balance_perdesc'),
				),
			),
			array(
				'title'=>'底部导航',
					'list'=>array(
									array('type'=>'array','name'=>'footernav','add_tip'=>'添加一个底部导航',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标'),
										array('type'=>'string','name'=>'action','title'=>'导航链接'),							
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标','help'=>'图标，例如：icon-shouye'),							
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'导航链接'),
									)
								),
					)
			),
		),
	);
	$return['rate_type']=array('只计算商户订单','只计算总部订单','全部订单计算');
	$return['fenxiaototal_types']=$this->fenxiaototal_types;
	$return['leveltype']=$this->level_up_types;
	$return['commissiontype']=$this->commission_types;
	$return['become']=array('1'=>'后台指定','2'=>'申请','3'=>'无条件','4'=>'消费金额');
	$return['withdraw']=$this->pay_types;
	$return['htmls']=$htmls;
	exi($return);
}
/*******basic*******/
/*******op*******/
